package com.huangyong.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.huangyong.dao.ArticleMapper;
import com.huangyong.entity.Article;
import com.huangyong.service.ArticleService;

@Service
public class ArticleServiceImpl implements ArticleService {
	
	@Autowired
	private ArticleMapper articleMapper;

	@Override
	public String delete(int id) {
		if(articleMapper.delete(id)==1) {
			return "success";
		}
		return "failed";
	}

	@Override
	public String insert(Article article) {
		if(articleMapper.insert(article)==1) {
			return "success";
		}
		return "failed";
	}

	@Override
	public Article findById(int id) {
		return articleMapper.findById(id);
	}

	@Override
	public String update(Article article) {
		if(articleMapper.update(article)==1) {
			return "success";
		}
		return "failed";
	}

	@Override
	public List<Article> findAll() {
		return articleMapper.findAll();
	}

	@Override
	public List<Article> findByName(String name) {
		return articleMapper.findByName(name);
	}

	@Override
	public List<Article> findByUid(String uid) {
		return articleMapper.findByUid(uid);
	}

}
